<!DOCTYPE html>
<html>

<head>
    <include file="Share:meta" />
    <style type="text/css">
    .trstyle0 {
        background-color: #e8e8e8;
    }
    .noty_message_h{ height: 100px; padding: 15px; }
    .noty_text{ font-size: 16px; font-weight: bold; }
    .desc{ font-size: 12px; color: #999; }
	.mybutton { width:200px; margin-bottom:10px; overflow:hidden; cursor:default; }
	.mybutton2 { display:block; margin-top:5px; width:72px; height:25px; line-height:20px; }
    </style>
    <script type="text/javascript">
        function savenote(obj,order_no){
            $.ajax({
                type: "POST",
                url: "/Admin/Order/olist?savenote=Y",
                headers: {},
                data: {
                    note: $('#'+obj).val(),
                    order_no: order_no
                },
                dataType: "json",// html/json/jsonp/xml
                success: function(msg){
                    // console.log(msg);
                    noty({
                          text: msg.message, 
                          layout: "top", 
                          timeout: 5000,
                          type: 'warning'
                    });
                },
                error: function(){
                    alert('保存失败');
                }
            });
        }
    </script>
</head>

<body class="hold-transition skin-blue sidebar-mini">
    <div class="wrapper">
        <include file="Share:header" />
        <include file="Share:left" />
        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
                <h1>订单列表<small><a target="_blank"></a></small></h1>
                <ol class="breadcrumb">
                    <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                    <li class="active">订单列表</li>
                </ol>
            </section>
            <!-- Main content -->
            <section class="content">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">
                            <a class="btn btn-info" href="__APP__/Admin/order/olist/" role="button">全部</a>
                            <a class="btn btn-info" href="__APP__/Admin/order/olist/order_status/7" role="button">等待印刷中</a>
                            <a class="btn btn-info" href="__APP__/Admin/order/olist/order_status/1" role="button">未支付</a>
                            <a class="btn btn-info" href="__APP__/Admin/order/olist/order_status/10" role="button">已发货</a>
                            <a class="btn btn-info" href="__APP__/Admin/order/olist/order_status/11" role="button">已完成</a>
                        </h3>
                        <div class="box-tools">
                            <form action="" method="GET" role="form">
                                <div class="input-group input-group-sm" style="width: 250px;">
                                    <input type="text" name="order_no" class="form-control pull-right" placeholder="订单号">
                                    <div class="input-group-btn">
                                        <button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-footer clearfix">
                        <ul class="pagination pagination-sm no-margin pull-right">
                            {$show}
                        </ul>
                    </div>
                    <div class="box-body">
                    	<table class="table table-bordered HjTable" border="1">
                            <tbody>
                                <tr style="background-color: #E6E6FA;">
                                    <th style="width: 5%;">订单号</th>
                                    <th style="width: 5%;">文件</th>
                                    <th style="width: 7%;">数量</th>
                                    <th style="width: 25%;">联系人</th>
                                    <th style="width: 15%;">名片属性</th>
                                    <in  name="rid" value="1,5">
                                        <th style="width: 15%;">订单备注</th>
                                    </in>
                                    
                                    <!-- <th style="width: 10%;">下单时间</th> -->
                                    <th style="width: 15%"></th>
                                </tr>
                                <volist name="list" id="vo">
                                    <tr class='trstyle{$vo.status}'>
                                        <!--class='trstyle{$vo.status}' -->
                                        <td id="order_{$vo.order_no}" rowspan="{$cart[$vo['order_no']]|count|add}">
                                            {$vo.order_no}<br><br>
                                            <b>状态: <br>{$orderStatus[$vo[order_status]]}</b>
                                            
                                            <egt name="vo.order_shipping_cost" value="1">
                                            <br/><br/><span style="color:#f00; font-weight:bolder;">加急快递</span>
                                            </egt>
                                        </td>
                                        <td>
                                        	<form class="form-horizontal" action="" method="post" enctype="multipart/form-data">
                                                <input type="hidden" name="oid" value="{$vo.oid}" />
                                                <input type="hidden" name="order_no" value="{$vo.order_no}" />
                                                <label title="上传" for="inputImage1" class="btn btn-default mybutton">
                                                    <input type="file" name="order_img" id="order_img">
                                                    <input type="submit" value="上传" class="mybutton2"/>

                                                </label>
                                            </form>
                                            <empty name="vo.order_img">
                                                <a class="btn btn-large btn-block btn-default" role="button" style="color:#666;">暂无文件</a>
                                                <else />
                                                <a class="btn btn-large btn-block btn-info" href="__APP__/Admin/Order/download/order_no/{$vo.order_no}" role="button" target="_blank">下载文件</a>
                                            </empty>
                                        </td>
                                        <td>{$vo.number}</td>
                                        
                                        <td>
                                            {$vo.shipping_name} / {$vo.shipping_mobile}
                                            <br> {$vo.shipping_province}{$vo.shipping_city}{$vo.shipping_distinct}
                                            <br> {$vo.shipping_address}
                                            <br><br> <i>{$vo.ctime}</i>
                                        </td>
                                        <td>
                                        <p class="desc">外包装：</p>
                                        <p>{$vo.product_outside_name}</p>
                                        <p class="desc">内包装：</p>
                                        <p>{$vo.product_inside_name}</p>
                                        </td>
                                        <in  name="rid" value="1,5">
                                        <td rowspan="{$cart[$vo['order_no']]|count|add}">
                                            <textarea id="note{$vo.order_no}" rows="4">{$vo.note}</textarea><br>
                                            <button type="button" class="btn btn-xs btn-info" onClick="savenote('note{$vo.order_no}','{$vo.order_no}');">保存</button>
                                        </td>
                                        </in>
                                        <!-- <td></td> -->
                                        <td rowspan="{$cart[$vo['order_no']]|count|add}">
                                            <a class="btn btn-info" style="margin-bottom: 5px;" href="__APP__/Admin/Order/detail/order_no/{$vo.order_no}" role="button">查看详情</a>
                                            <eq name="vo.order_status" value="1">
                                                <button type="button" style="margin-bottom: 5px;" onClick="Toast('{$vo.order_no}')" class="btn btn-success">支付订单</button>
                                                <button type="button" style="margin-bottom: 5px;" onClick="cancelOrder('{$vo.order_no}')" class="btn btn-danger">取消订单</button>
                                            </eq>
                                            
                                        </td>
                                    </tr>
                                    <notempty name="cart[$vo['order_no']]">
                                    <volist name="cart[$vo['order_no']]"  id="vo">
                                    <tr style="background:#eee;">
                                    	<td>{$vo.pname}</td>
                                        <td>{$vo.quantity}</td>
                                        
                                        <td>&yen;{$vo.price}</td>
                                        <td>{$vo.color_name}</td>
                                    </tr>
                                    </volist>
                                    </notempty>
                                </volist>
                            </tbody>
                        </table>
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer clearfix">
                        <ul class="pagination pagination-sm no-margin pull-right">
                            {$show}
                        </ul>
                    </div>
                </div>
            </section>
            <!-- /.content -->
        </div>
        <!-- /.content-wrapper -->
        <include file="Share:copyright" />
        <include file="Share:setting" />
    </div>
    <include file="Share:js" />
    <script type="text/javascript">
	$(function(){
		dingwei = "{$Think.get.dingwei}";
		if(dingwei!='') {
			location.href = "#order_" + dingwei;
		}
	});
	
    $("#OrderManager").addClass("active");
    $("#order_list").addClass("active");

    function Toast(order_no) {
        noty({
            text: '使用印刷码支付订单后无法撤销！确认支付订单：'+order_no+" ？",
            layout: 'center',
            template: '<div class="noty_message_h"><span class="noty_text"></span><div class="noty_close"></div></div>',
            buttons: [{
                addClass: 'btn btn-primary',
                text: '确定',
                onClick: function($noty) {
                    // this = button element 也就是当前的按钮
                    // $noty = $noty element 也就是当前这个提示信息对象
                    $noty.close();
                    window.location.href="__APP__/Admin/Order/payorder?order_no="+order_no;
                }
            }, {
                addClass: 'btn btn-danger',
                text: '取消',
                onClick: function($noty) {
                    $noty.close();
                }
            }]
        });
    }

    function cancelOrder(order_no) {
        noty({
            text: '确认取消订单：'+order_no+" ？",
            layout: 'center',
            template: '<div class="noty_message_h"><span class="noty_text"></span><div class="noty_close"></div></div>',
            buttons: [{
                addClass: 'btn btn-primary',
                text: '确定',
                onClick: function($noty) {
                    // this = button element 也就是当前的按钮
                    // $noty = $noty element 也就是当前这个提示信息对象
                    $noty.close();
                    window.location.href="__APP__/Admin/Order/cancelOrder?order_no="+order_no+"&p={$Think.get.p}";
                }
            }, {
                addClass: 'btn btn-danger',
                text: '取消',
                onClick: function($noty) {
                    $noty.close();
                }
            }]
        });
    }
    </script>
</body>

</html>
